package com.forum.module.blog.convert.notification;

import com.forum.framework.common.util.colletion.CollectionUtils;
import com.forum.framework.common.util.object.BeanUtils;
import com.forum.module.blog.controller.notification.vo.NotificationRespVO;
import com.forum.module.blog.dal.dataobject.notification.NotificationDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface NotificationConvert {
    NotificationConvert INSTANCE = Mappers.getMapper(NotificationConvert.class);

    default List<NotificationRespVO> covertList(List<NotificationDO> list) {
        return CollectionUtils.convertList(list, this::covert);
    }

    default NotificationRespVO covert(NotificationDO notificationDO) {
        return BeanUtils.toBean(notificationDO, NotificationRespVO.class);
    }
}
